﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using StructureMap;

namespace IOCSolution.StructureMap
{
    public class StructureMapRunner : IRunner
    {
        public string Name
        {
            get { return "StructureMap"; }
        }

        public void Init()
        {
            ObjectFactory.Initialize(c =>
            {
                c.For<IDatabase>().Use<OracleDatabase>();
                c.For<DatabaseHelper>().Singleton();
            });
        }

        public void Start()
        {
            Console.WriteLine("\r\nthis name: " + Name);
            var manager = ObjectFactory.GetInstance<DatabaseHelper>();
            manager.Search("select * from users");
        }
    }
}
